package com.jairrillo.mbeans;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.validation.constraints.Size;

@RequestScoped
@ManagedBean
public class UserBean {

	private List<String> countriesList;

	public UserBean() {
		
		countriesList = new ArrayList<String>();
		countriesList.add("England");
		countriesList.add("France");
		countriesList.add("Germany");
		countriesList.add("Italy");
		countriesList.add("Spain");

	}

	public List<String> autocomplete(Object prefix) {

		return countriesList;
	}

	@Size(min = 3, max = 12)
	private String name;

	@Size(min = 3, max = 12, message = "Must be between 3 and 12 chars {javax.validation.constraints.Mine.message}")
	private String surname;

	private String state;

	public String getState() {
		return state;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String register() {
		return "success";
	}

	public List<String> getCountriesList() {
		return countriesList;
	}

}
